/*
https://leetcode.cn/problems/xor-queries-of-a-subarray/
1310. 子数组异或查询
*/
class Solution {
public:
    vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) {
        int n=arr.size();
        vector<int>yh(n+1,0);vector<int>ans;
        yh[0]=arr[0];
        yh[1]=arr[0];
        for(int i=2;i<=n;++i){
            yh[i]=yh[i-1]^arr[i-1];
        }
        cout<<endl;
        for(int i=0;i<queries.size();++i){
            int a,b;
            a=queries[i][0];
            b=queries[i][1];
            if(a==0) 
            ans.push_back(yh[b+1]);
            else
            ans.push_back(yh[a]^yh[b+1]);
        }
        
        return ans;
    }
};